home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD ROM Paradise Collection 4
/
CD ROM Paradise Collection 4 1995 Nov.iso
/
edit
/
yame.zip
/
YAME.DOC
< prev
next >
Wrap
Text File
|
1994-12-18
|
43KB
|
1,222 lines
───────────────────────────────────────────────────────────────
▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄
▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄
▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄
▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄
▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄
▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄
▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄
▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄
▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄
▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄ ▄
───────────────────────────────────────────────────────────────
Yet Another Memo Editor
(for dBASE IV)
version 1.00 12/18/94
Copyright (c) 1994 Kenneth Chan. All rights reserved.
═════════════════════════════════════════════════════════════════
QUICK START
═════════════════════════════════════════════════════════════════
Y.COM is the name of the YAME executable file.
Y.COM can also be LOADed and CALLed as a dBASE module. More on
that later.
Depending on how much control you want over YAME, using it may be
as simple as:
(1) Add/modify the WP entry of the CONFIG.DB file
Add
WP = Y
if Y.COM is on your PATH. If it is not on your PATH, specify
the full pathname to Y.COM.
That's it! To see YAME in action:
(a) Start dBASE
(b) Go to the dot prompt
(c) SET STATUS ON, if it is not ON already
(d) USE a database with a memo field (or CREATE one)
(e) EDIT a record (or APPEND one)
(f) Cursor to a memo field
(g) Press Ctrl-Home to zoom into the memo field
(h) You are now in YAME. Cursor around; try entering and
deleting some text. Notice the line and column indicator
(i) To save and quit, press Ctrl-End or Ctrl-W. To quit
without saving, press Esc (if you made any changes, you
will be asked if you want to lose them).
If you want more control over YAME, you can use the YAMEPARM.BIN
module:
(2) LOAD the YAMEPARM module into memory.
From the dot prompt
LOAD YAMEPARM
(3) CALL YAMEPARM with the parameters you want to have in effect
the next time you edit a memo field.
For example, if you want to edit the memo in a 51-character
wide window in the middle of the screen, with a 50-character
word wrap margin:
CALL YAMEPARM with "/@5,15,16,65 /m50"
EDIT and zoom into the memo field again and see the new
parameters take effect.
You may CALL YAMEPARM with as often as you want, and use a
different set of parameters each time.
(4) When done, you should uninstall YAMEPARM by CALLing it with
no parameters:
CALL YAMEPARM
Here endeth the Quick Start.
═════════════════════════════════════════════════════════════════
ABOUT YAME
═════════════════════════════════════════════════════════════════
What it is
----------
YAME is a paragraph-oriented word-wrap text editor. That
means that YAME is designed for narrative text passages, like
long comments or case histories.
What it is not
--------------
YAME is not a line-oriented text editor. It is not suited for
writing programs. It is not a word processor; it has no
formatting or printing capabilities.
What's good about it
--------------------
YAME is faster than the built-in memo editor, especially with
large files. The built-in editor suffers greatly with large
files in two areas: cursor movement and I/O. Compare the time
required to read in a 60 KB memo and what happens when you
try to hold down the PgDn key all the way to the bottom.
YAME can operate in any size window, even one that is one
character high and one character wide.
YAME supports different word-wrap margins! The margin can be
any value from 1 to 65,534 characters.
YAME can limit the size of your memo fields to a total number
of bytes, a total number of lines, or both.
YAME allows an alternate save and exit key, in addition to
Ctrl-W and Ctrl-End.
YAME can be run as a .COM file or LOADed and CALLed as a .BIN
file, which avoids swapping overhead.
YAME can be reconfigured between calls without leaving dBASE.
YAME has a read-only mode.
YAME detects and works with the dBASE status line.
YAME supports the classic WordStar diamond cursor keys.
What's not so good
------------------
YAME can only edit files up to 64K in size.
What's dependent on your point of view
--------------------------------------
YAME does not have mouse support.
YAME has no menus.
What's best about YAME
----------------------
YAME is written by a dBASE developer for dBASE developers,
and is responsive to your input.
Why?
----
"I forget exactly how I ended up 'volunteering' to write a
memo editor replacement back on BORBBS. But I thought it was
doable and an interesting challenge. So I dove in and look at
all the trouble I've caused!" -- Kenneth Chan
How do you pronounce it?
------------------------
The preferred pronunciation is (YAH-meh); it should not rhyme
with "name" or "same".
By the way
----------
YAME is perfectly suited for general purpose word-wrap text
editing. It doesn't have to be run under dBASE.
═════════════════════════════════════════════════════════════════
USER'S GUIDE
═════════════════════════════════════════════════════════════════
Through the use of ComBin(tm) technology, there are two ways to
invoke YAME: (1) as a standard DOS .COM executable; and (2) as a
dBASE-CALLable .BIN. The same file (Y.COM) can be run either way.
Each method has its advantages.
As a .COM file
--------------
By adding the WP = Y entry in your CONFIG.DB file, dBASE will use
YAME as its external memo editor and run the Y.COM program
whenever you edit a memo.
Y.COM is just like any DOS executable program. It takes
parameters:
Y [<switches>] <filespec>
dBASE will copy the memo field into a temporary file, tack the
name of that temporary file at the end of whatever comes after
the WP =, and pass the whole thing to DOS. This means that you
can include any default parameters that you use with YAME on the
WP line. For example, if you prefer the line and column
indicators off by default, the WP line would look like:
WP = Y /I
You may also run Y.COM with the RUN/! command or RUN() function.
The .COM invocation is simpler, although at present, dBASE has
some quirks with external memo editors (see Quirks below).
As a .BIN file
--------------
Y.COM can also be LOADed and CALLed like a .BIN file. The
advantage of this is that there is no overhead associated with
shelling out to run a program. One hitch is that a .BIN cannot
allocate memory, so another .BIN will be used as editing buffer
space. That module is called YAMEBUFF.BIN. You need to
load YAMEBUFF
and then
call YAMEBUFF with <buffer size>
Where buffer size can be any number from 1 to 65024 (63.5 K).
This installs the YAMEBUFF buffer. You must then LOAD the Y.COM
file with the command
load Y.COM
Note that you must include the .COM extension, since the LOAD
command usually expects a .BIN. You may then CALL the Y module as
needed with the command
call Y with "[<switches>] <filespec>"
or the function
call( "Y", "[<switches>] <filespec>" )
One other hitch is that you'll need to copy the memo field to a
temp file before calling YAME, and then copy the file back to the
memo field when done. This is done with the COPY MEMO TO and
APPEND MEMO FROM OVERWRITE commands, respectively:
copy memo MEMO_FLD to MEMO_TMP.$DB
call Y with "MEMO_TMP.$DB"
append memo MEMO_FLD from MEMO_TMP.$DB overwrite
Before quitting dBASE, you should uninstall the YAMEBUFF buffer
with the command (note no parameters)
call YAMEBUFF
Parameter passing
-----------------
Essential to the flexibility of YAME is its capability to
dynamically configure itself without leaving dBASE. This is
achieved with tiered parameters. When invoked, YAME attempts to
process four stages of parameters:
(1) Default
(2) .COM invocation
(3) YAMEPARM
(4) .BIN invocation
When run as a .COM, YAME will go through stages 1, 2, and 3; for
.BIN invocation, stages 1, 3, and 4. Some examples will make
things clearer:
Let's say that you want to run YAME as your external memo editor,
a .COM invocation. You want a margin of 50 for most of your memo
fields. The default word wrap margin is 65 characters. You add
the following WP line to your CONFIG.DB file:
WP = Y /m50
Every time you edit a memo, dBASE runs YAME. When YAME starts, it
sets its margin to the default, 65. It then sees the parameter
specified when it was run, a margin of 50. That is the margin
that is used.
If you then want a margin of 70 for a particular memo, you'll
need to override the default margin of 65 and the margin of 50
specified on the WP line of the CONFIG.DB file. This is when
YAMEPARM comes in. You CALL YAMEPARM with parameters that you
want:
call YAMEPARM with "/m70"
The next time YAME runs, it will set its default margin, then the
margin of 50, and then see the parameter in YAMEPARM and use
that. If you had another memo with a margin of 40, you'd:
call YAMEPARM with "/m40"
and when you want to revert back to the WP parameters, you'd:
call YAMEPARM
Parameters set up through YAMEPARM will stay in effect until
different parameters are sent, or until you uninstall YAMEPARM by
CALLing it with no parameters.
For a .BIN invocation, you'd use YAMEPARM to set your personal
defaults:
call YAMEPARM with "/m50"
From then on, every time you CALL Y, YAME will first set the
margin to its default, 65, then see the margin in YAMEPARM and
use that. If you then wanted a margin of 70, you'd include the
margin parameter in the CALL:
call Y with "/m70 MEMO_TMP.$DB"
If you ever want to go back to your personal default of 50, leave
out the margin parameter in the CALL to YAME:
call Y with "MEMO_TMP.$DB"
And if you ever want to use YAME's default of 65, you can
call YAMEPARM
to clear your personal default as well.
Sample .COM implementation
--------------------------
For this example, you'll be using YAME as a direct memo editor
replacement. Your .DBF has two memo fields: ARG_PRO and ARG_CON.
You want to show them side-by-side on the screen, with a border
around each. This yields a word wrap margin of 37:
( 80 cols / 2 memos ) - 2 for border - 1 = 37
You'll want the margin to be one less than the width of the
window so that the cursor can rest at the end of the longest line
without the memo panning back and forth. In this example, you put
the YAME executable, Y.COM, in your \DBASE directory, but \DBASE
is not on your PATH, so you add the following line to your
CONFIG.DB file:
WP = \DBASE\Y /m37 /ss
By using the /SS switch, YAME will save the memos in dBASE-native
format, with soft carriage returns. Without them, dBASE will not
display the memos with the word-wrapping you got while within
YAME.
You'll need YAMEPARM to dynamically configure YAME during your
dBASE session, so one of first things you do is:
load YAMEPARM
from the dot prompt. You then proceed to design the screen form
normally. You want the memo fields to display as open windows.
Draw the windows normally and note the coordinates of the
corners. Since you want them to display equally side-by-side,
you're guaranteed that the columns will be 0, 39, 40 and 79.
Let's say that the rows you end up with after laying everything
out are 11 on the top and 19 on the bottom.
For the ARG_PRO field on the left, you add the following to the
Permit edit if option:
call( "YAMEPARM", "/@11,0,19,39 /bd" ) = "T"
When CALLing YAMEPARM with the CALL() function, CALL() will
return the parameter string. YAMEPARM confirms that the parameter
is received by changing the first character in the parameter
string to a "T". If YAMEPARM fails, the first character will be
changed to an "F" (see More about YAMEPARM and YAMEBUFF below).
SET EXACT must be OFF (the default) for this "begins with T"
comparison to return .T., thus allowing the GET while setting the
parameters for that field. The ARG_CON field would be similarly
configured:
call( "YAMEPARM", "/@11,40,19,79 /bd" ) = "T"
In both of these cases, you're using a double border line for the
window when you're actually editing the memo. You can now
generate the .FMT and use the form.
When all done, you should uninstall and unload YAMEPARM:
call YAMEPARM
release module YAMEPARM
It is absolutely critical that you uninstall YAMEPARM by CALLing
it with no parameters before RELEASing it and/or QUITting dBASE.
Sample .BIN implementation
--------------------------
To implement the same two fields with a .BIN invocation of YAME,
the first thing you will need is to load and install the edit
buffer:
load YAMEBUFF
call YAMEBUFF with 8000
You don't want the pro and con arguments to be too wordy, so
you've set the limit of the memo field to approximately 8 KB.
This is the largest memo that YAME will allow. This limit is
enforced by the YAME program, and does not actually affect the
amount of memory occupied by YAMEBUFF.BIN
You will also need two generic routines, one to display the memo,
and one to handle the keyboard:
PROCEDURE DispMemo
parameter cMemoFld, nTop, nLft, nBtm, nRht
private nOldWidth, n1
nOldWidth = set( "MEMOWIDTH" )
*-- Set MEMOWIDTH for window
set memowidth to nRht - nLft - 2
*-- Draw border
@ nTop, nLft to nBtm, nRht
@ nTop + 1, nLft + 1 clear to nBtm - 1, nRht - 1
n1 = 1
*-- Display each line
do while n1 < nBtm - nTop
@ nTop + n1, nLft + 1 say mline( &cMemoFld., n1 )
n1 = n1 + 1
enddo
set memowidth to nOldWidth
RETURN
FUNCTION MemoKey
parameters nTop, nLft, nBtm, nRht, cExtraParm
*-- Make sure extra parameter is defined
if pcount() < 5
cExtraParm = ""
endif
private nRow, nCol, lLoop, cYAMEPARM, cMemoFld, cColorFld
*-- Construct YAME parameter string
cYAMEParm = "/m" + ltrim( str( nRht - nLft - 2 )) + " /@" + ;
ltrim( str( nTop )) + "," + ltrim( str( nLft )) + "," + ;
ltrim( str( nBtm )) + "," + ltrim( str( nRht )) + ;
" /bd " + cExtraParm + " MEMO_TMP.$DB"
cMemoFld = varread()
nRow = row()
nCol = col()
*-- Get the COLOR OF FIELDS
cColorFld = substr( set( "ATTRIBUTES" ), ;
rat( ",", set( "ATTRIBUTES" )) + 1 )
if file( "MEMO_TMP.$DB" )
erase MEMO_TMP.$DB
endif
copy memo &cMemoFld. to MEMO_TMP.$DB
lLoop = .t.
do while lLoop
nKey = inkey( 0 )
do case
case nKey = 29 .or. nKey = -8 && Ctrl-Home or F9
save screen to sMemoKey
*-- Invoke YAME; exit code returned in parameter string
call Y with cYAMEParm
restore screen from sMemoKey
release screen sMemoKey
*-- Check exit code to see if file was saved
if cYAMEParm = "0"
*-- Update memo field
append memo &cMemoFld. from MEMO_TMP.$DB overwrite
endif
*-- If memo marker is outside the window
if nRow < nTop .or. nRow > nBtm .or. ;
nCol + 3 < nLft .or. nCol > nRht
*-- Update the memo marker
@ nRow, nCol say iif( len( &cMemoFld. ) = 0, "memo", ;
"MEMO" ) color &cColorFld.
else
*-- Redisplay memo
do DispMemo with cMemoFld, nTop, nLft, nBtm, nRht
endif
*-- Overwrite exit code with original slash
cYAMEParm = stuff( cYAMEParm, 1, 1, "/" )
*-- Do not KEYBOARD Ctrl-Home
nKey = 0
case "," + ltrim( str( nKey )) + "," $ ;
",1,3,4,5,6,9,13,17,18,19,23,24,27,-400,"
*-- These keys will move the cursor, let them pass
case nKey > 0 .and. nKey < 256
*-- Ignore all other non-function keys
nKey = 0
otherwise
*-- KEYBOARD function key to allow for ON KEY traps
keyboard "{" + ltrim( str( nKey )) + "}"
*-- but don't leave
nKey = 0
endcase
if nKey # 0
*-- Type key
keyboard "{" + ltrim( str( nKey )) + "}" clear
*-- Quit loop
lLoop = .f.
endif
*-- Move cursor back after possible memo redraw
@ nRow, nCol say ""
enddo
if file( "MEMO_TMP.$DB" )
erase MEMO_TMP.$DB
endif
*-- Return .T. to read stuffed keystroke
RETURN .t.
The DispMemo procedure simply uses the dBASE function MLINE() to
display the memo in a simulated window. The MemoKey() function is
to be used in the WHEN clause of a memo GET. During a READ, when
the cursor arrives at the memo field, it waits for a keystroke;
every time Ctrl-Home or F9 is pressed, YAME is invoked. Keys that
would move the cursor to another field are passed through, and
all other keys are ignored.
To actually GET the two memo fields, your code would look
something like this:
clear
@ 12, 1 get ARG_PRO ;
when MemoKey( 11, 0, 19, 39, "" )
do DispMemo with "ARG_PRO", 14, 0, 21, 39
@ 12,41 get ARG_CON ;
when MemoKey( 11, 40, 19, 79, "" )
do DispMemo with "ARG_CON", 14, 40, 21, 79
read
You'll want to place the memo marker at the top left corner of
the inside of the window, so that when the cursor gets to the
memo field, it will appear to be at the beginning of the memo.
After placing the marker, you use the DispMemo procedure to
display the memo window over it. From then on, the markers will
be obscured.
When you're all done, don't forget to uninstall and unload the
edit buffer:
call YAMEBUFF
release module YAMEBUFF
It is absolutely critical that you uninstall YAMEBUFF by CALLing
it with no parameters before RELEASing it and/or QUITting dBASE.
More about YAMEPARM and YAMEBUFF
--------------------------------
YAMEPARM and YAMEBUFF communicate with Y.COM by using one of the
User Interrupt Vectors (Int 60h - 66h) or some normally unused
ROM BASIC vectors (97h-AFh). Some of these vectors are used by
other programs and drivers, but there are usually a few
available.
YAMEPARM and YAMEBUFF each use their own vector, so if both of
them are LOADed and installed, they use two vectors. If they are
not uninstalled before they are RELEASEd and/or you QUIT dBASE,
those vectors will not be cleared. Pretty soon, there will be no
free vectors, and YAMEPARM and YAMEBUFF will fail.
Therefore, it is absolutely critical that you uninstall YAMEPARM
and YAMEBUFF by CALLing them with no parameters before RELEASing
them and/or QUITting dBASE. Again, IT IS ABSOLUTELY CRITICAL THAT
YOU UNINSTALL YAMEPARM AND YAMEBUFF BY CALLING THEM WITH NO
PARAMETERS BEFORE RELEASING THEM AND/OR QUITTING DBASE.
YAMEPARM will indicate successful installation by changing the
first letter of the parameter string to a "T"; failure is
indicated by an "F". For example, the sequence
cParm = "/@11,0,19,39 /bd"
call YAMEPARM with cParm
will change the memory variable cParm to
"T@11,0,19,39 /bd"
if YAMEPARM is installed successfully and
"F@11,0,19,39 /bd"
if it is not. Once installed successfully, further CALLs to
YAMEPARM should return "T", until of course YAMEPARM is RELEASEd
or dBASE QUITs. Since the memory variable is changed, the
original character, usually a "/", must be restored before using
the parameter string again.
Note that every time you pass parameters to YAMEPARM, they stay
memory resident. You do not have to CALL YAMEPARM before every
single memo. You only need to use YAMEPARM when the parameters
change.
YAMEBUFF operates in a similar manner. You CALL YAMEBUFF with the
maximum file size you want to allow. This limit is enforced by
the YAME program, and does not affect the amount of memory
occupied by YAMEBUFF.BIN. YAMEBUFF.BIN is almost 64 KB in size;
most of it, 63.5 KB or 65024 bytes, is buffer space; the
remainder is the YAMEBUFF installation code. Even if you
call YAMEBUFF with 4000
to keep the memo fields below 4 KB, YAMEBUFF will still occupy 64
KB of memory. In these situations, you can use the smaller buffer
file, YAMEBUF8.BIN, which has 8 KB (8192 bytes) of buffer space.
YAMEBUF8 works exactly like YAMEBUFF, except that the maximum
maximum is only 8 KB, not 63.5 KB. Do not have YAMEBUFF and
YAMEBUF8 LOADed simulataneously.
YAMEBUFF (and YAMEBUF8) will return the amount of space that was
registered as the maximum allowable file size. In most cases,
this means that your parameter will be returned unchanged. The
exceptions are:
(1) You asked for more space than there was in the .BIN, i.e.
more than 65024 for YAMEBUFF and 8192 for YAMEBUF8. In
those cases, those limits will be registered and
returned.
(2) You asked for more than 65535 bytes. Don't do that.
(3) YAMEBUFF was unable to install itself. In this case,
YAMEBUFF will return 0. You should verify that the return
value is greater than zero to make sure that YAMEBUFF was
installed before your try to edit something.
If either YAMEPARM or YAMEBUFF return failure codes ("F" and 0,
respectively), this means that there were no available vectors to
hook into. This is because either you've already got a ton of
gizmos loaded in your system, or, more likely, you forgot to
uninstall YAMEPARM or YAMEBUFF before RELEASing them and/or
QUITting dBASE. Remember that it is absolutely critical that you
uninstall YAMEPARM and YAMEBUFF by CALLing them with no
parameters before RELEASing them and/or QUITting dBASE.
Using YAME with dBASE 5 for DOS
-------------------------------
dBASE 5 for DOS includes a fully windowed word-wrap EDITOR object
that finally supports variable margins. (In fact, as you resize
the editor window, it re-wraps on-the-fly -- pretty slick.)
If you still want to use YAME, it does work in dBASE 5 (as does
virtually all dBASE IV code) with no modifications. YAME is
modal, which means that when YAME is running, you cannot switch
to another on-screen form or menu, especially with the mouse,
since the mouse is disabled while YAME is active.
dBASE 5 has a new SET WP command, which allows you to change the
memo editor as needed during your dBASE session. Therefore, you
do not need to set the WP = option in the CONFIG.DB file. You
can:
set wp to Y.COM
when you want to use YAME as your memo editor, and
set wp to
to switch back to the built-in memo editor. Note that when using
dBASE IV-style @ GETs, the built-in memo editor is the old dBASE
IV memo editor, and when using CUA forms with an ENTRYFIELD
DataLink'd to a memo field, the built-in memo editor is the new
EDITOR object.
You cannot use YAME as your SET WP memo editor with CUA forms,
since the exit codes returned by Y.COM cause dBASE 5 to think
there was an error ("Invalid path or filename") if you exit the
memo with saving. You can still use YAME with CUA forms by
setting up an event handler that runs or calls YAME manually.
Finally, the EDITOR object in dBASE 5 for DOS uses a soft
carriage return and a normal carriage return together to indicate
the end of a word-wrapped line. The built-in memo editor in dBASE
IV uses a soft carriage return and a line feed. This means that
memos edited by the EDITOR object in dBASE 5 will not be read
properly by the built-in memo editor in dBASE IV. On the other
hand, the EDITOR object understands dBASE IV memos when it first
reads them, and saves them in its own format. YAME can read
either type of soft carriage return, but when saving with soft
carriage returns with the /SS switch, saves in dBASE IV format.
═════════════════════════════════════════════════════════════════
REFERENCE
═════════════════════════════════════════════════════════════════
Keys
----
Keys are listed in function groups.
Stopping what you started
-------------------------
Esc Quit without saving
Ctrl-End Ctrl-W Save and quit
Ctrl-K/D Save and quit
Ctrk-K/X Save and quit
Moving around
-------------
Home Ctrl-Z Beginning of line
End Ctrl-B End of line
Up Ctrl-E Up a line
Down Ctrl-X Down a line
Left Ctrl-S Left one character
Right Ctrl-D Right one character
PgUp Ctrl-R Up one window
PgDn Ctrl-C Down one window
Ctrl-Left Ctrl-A Left one word
Ctrl-Right Ctrl-F Right one word
Ctrl-PgUp Beginning of file
Ctrl-PgDn End of file
Alt-R Beginning of paragraph
Alt-C End of paragraph
Inserting and deleting
----------------------
Insert Ctrl-V Toggle insert mode
Del Ctrl-G Delete one character to right
Backspace Ctrl-H Delete one character to left
Ctrl-T Delete word
Ctrl-Y Delete line
Ctrl-N Insert new line
Tab Ctrl-I Tab forward
Shift-Tab Tab backward
Block
-----
Ctrl-K/B Drop block anchor
Ctrl-K/K Raise block anchor
Ctrl-K/H Unmark block
Ctrl-K/C Copy block
Ctrl-K/V Move block
Ctrl-K/Y Delete block
Word wrapping
-------------
Alt-B Rewrap paragraph
Control characters (ASCII values 1-31) except the tab, line
feed, and carriage return (ASCII 9, 10, and 13) can be
entered using the ALT-keypad method.
Switches/Parameters
-------------------
All switches start with a slash and are separated by spaces.
There must be no spaces within each parameter. The parameters
that may be used with either Y.COM or YAMEPARM.BIN are:
/@[<top>][,[<left>][,[<bottom>][,[<right>]]]]
/@ specifies the window size. You may leave out any of
the dimensions. The coordinates are zero-based.
/B[S|D|P|<border definition string>]
/BS single line border
/BD double line border
/BP panel border
/B no border
The <border definition string> follows the format of SET
BORDER, as follows:
[<1>][,[<2>][,[<3>][,[<4>][,[<5>][,[<6>][,[<7>][,[<8>
]]]]]]]]
where each number 1 through 8 MUST be a decimal value for
any ASCII character. The required order for specifying
the sides and corners using 1 through 8 is:
5╔═══════════════1═══════════════╗6
║ ║
║ ║
3 4
║ ║
║ ║
7╚═══════════════2═══════════════╝8
/C[<text>][,[<block>][,[<border>][,[<indicator>]]]]
/C specifies the colors, using dBASE-standard color
descriptors.
<text> the color of text
<block> the color of blocked text
<border> the color of the border
<indicator> the color of the line and column indicators
/I[+|-|<row>,<col>]
/I- disables the line and column indicators
/I+ enables the line and column indicators
/I<row>,<col> enables the line and column indicators at
the specified coordinates. The indicator is 17 columns
wide.
/M[<margin>]
/M specifies the word wrap margin. You may use any number
from 1 to 65534.
/M0 specifies no word wrap.
/R[+|-]
/R+ displays the file in read-only mode. No editing is
possible.
/R- disables read-only mode (if had been enabled)
/S[Y|S|H]
/SY Save in YAME format (default)
/SS Save with soft CRs
/SH Save with hard CRs
By default, YAME saves paragraphs as single long lines of
text. This is the fastest save mode, and facilitates
importing by other programs that do word wrap, since
there are no extra characters.
dBASE's built-in memo editor uses soft carriage returns
(hex 8D0A) to mark line breaks, and uses them to
determine how to display the memo in a window. By using
/SS, the margins you use in YAME will be reflected in
memo windows.
You can also save the file with hard carriage returns
(hex 0D0A) at the end of the lines. This makes the lines
in a paragraph separate, as if you had pressed Enter at
the end of each line. This is useful if you need to print
the file, or import it into something that does not do
word wrap.
/T[<tabsize>]
/T specifies the tab size, from 1 to 255 characters
/X[<scancode>]
/X allows you to specify an alternate save & exit key,
such as F2. You must specify the decimal scancode for the
appropriate key:
Key Code Key Code Key Code
----------- ---- ----------- ---- ----------- ----
F1 59 Shift-F1 84 Ctrl-F1 94
F2 60 Shift-F2 85 Ctrl-F2 95
F3 61 Shift-F3 86 Ctrl-F3 96
F4 62 Shift-F4 87 Ctrl-F4 97
F5 63 Shift-F5 88 Ctrl-F5 98
F6 64 Shift-F6 89 Ctrl-F6 99
F7 65 Shift-F7 90 Ctrl-F7 100
F8 66 Shift-F8 91 Ctrl-F8 101
F9 67 Shift-F9 92 Ctrl-F9 102
F10 68 Shift-F10 93 Ctrl-F10 103
Key Code Key Code Key Code
----------- ---- ----------- ---- ----------- ----
Alt-F1 104 Alt-A 30 Alt-N 49
Alt-F2 105 Alt-B 48 Alt-O 24
Alt-F3 106 Alt-C 46 Alt-P 25
Alt-F4 107 Alt-D 32 Alt-Q 16
Alt-F5 108 Alt-E 18 Alt-R 19
Alt-F6 109 Alt-F 33 Alt-S 31
Alt-F7 110 Alt-G 34 Alt-T 20
Alt-F8 111 Alt-H 35 Alt-U 22
Alt-F9 112 Alt-I 23 Alt-V 47
Alt-F10 113 Alt-J 36 Alt-W 17
Alt-K 37 Alt-X 45
Alt-L 38 Alt-Y 21
Alt-M 50 Alt-Z 44
/Z[<byte limit>|L[<line limit>]]
/Z allows you to limit the size of the memo field
entered, either the total number of bytes with /Z<bytes>
or the total number of lines with /ZL<lines>. If YAMEBUFF
is used, the buffer size specified when installing has
priority. Both a total byte and total line count can be
specified by using two separate /Z switches.
Using /Z or /ZL with no number will reset the respective
sizes to their maximum: 65,535 for both.
Defaults
--------
The default settings for YAME are:
Window size:
Top: row 1
Left: column 0
Right: right edge of the screen
Bottom: if the dBASE status line is detected, the bottom
row is the row above the status line; if not, the
bottom of the screen.
YAME detects and works with most displays at various
screen sizes.
Border: None
Color: W+/B,RG+/GB,RG+/GB,B/W
Indicators:
If the status line is detected, the indicators are in the
middle of the status line, where the built-in memo
editor's indicators are. If not, the indicators occupy
row 0.
Margin: 65
Read-Only: Off
Save mode: YAME-native
Tab size: 8
Return codes
------------
Upon exit, YAME returns the following codes:
0 = Save and exit
-------------
The file was saved upon exit by pressing Ctrl-End. If not
in read-only mode, the file is always rewritten, even if
no changes were made. If in read-only mode, the file is
not actually saved, but this code is returned so that you
can determine the exit key.
1 = Exit without saving
-------------------
The file was abandoned by pressing Esc. If any changes
were made, they were discarded.
2 = No filespec
-----------
There was no file specified anywhere along the line, so
there was nothing to do. When run as a .COM, this will
cause YAME to print its banner and information screen.
3 = Error opening file
------------------
What YAME thought was the filename (the last non-switch
parameter it encountered) was invalid in some way,
usually an invalid drive/directory, or it contained
invalid characters.
4 = Memory allocation error
-----------------------
In the .COM invocation, there was not enough free memory
to allocate a 64 KB editing buffer. In the .BIN
invocation, YAME could not find YAMEBUFF.
When run as a .COM, these codes are returned as standard DOS
ERRORLEVELs, which are visible in dBASE by using the RUN()
function with the first parameter set to .T., e.g.
nErrLvl = run( .t., "\DBASE\Y.COM", .t. )
Remember that when the first parameter is .T., the PATH does not
work; you must specify the full directory and file name.
When run as a .BIN, YAME will change the first character of the
parameter string to the appropriate digit. This means that if you
want the return code, you must pass a parameter with your CALL,
even if it is just a blank space, e.g.
if call( "Y", " " ) = "0" && was the file saved?
If you're using a memory variable for your CALL parameter, don't
forget to restore the first character (usually a "/") since it
was overwritten by the return code.
═════════════════════════════════════════════════════════════════
QUIRKS
═════════════════════════════════════════════════════════════════
These quirks are not YAME-specific, but rather issues that come
up when dealing with memo fields. Any or all of them may be
resolved in future releases of dBASE:
Shelling out to external memo editor leaves 0-byte files
--------------------------------------------------------
When using an external memo editor, dBASE copies the current memo
field to a temp file with the name TMPnnnnn.$DB, where nnnnn is a
random 5-digit number. dBASE also creates a 0-byte file of the
same name in the dBASE temporary directory (usually specified
with the DBTMP DOS environment variable).
dBASE does not delete the 0-byte .$DB file when done editing the
memo field. Successive edits will create more and more of these
files in the dBASE temporary directory. This has 3 effects:
(1) If the temporary directory is the root directory of a
drive, you may run out of available directory entries.
Don't make the dBASE temporary directory the root
directory of a drive.
(2) Although they occupy no disk space, all these empty files
will reduce performance when the number of directory
entries gets very large (in the hundreds).
(3) When dBASE quits, those files will still be there,
cluttering the directory. Unless the temporary directory
is on a RAM disk, you will probably want to delete these
files. Don't do a DEL *.$DB while in dBASE, since there
are other files with the .$DB extension that are needed
by dBASE.
Returning from external memo editor erases last two lines
---------------------------------------------------------
When dBASE restores the screen after returning from an external
memo editor, the last two lines on the screen are blank. If you
are using a format file, the format is refreshed, so the entire
screen is rewritten, solving the problem.
If you're not using a format file, as with a READ, those last two
lines (lines 23 and 24 in 25-line mode) are lost. Since the
cursor is still on the memo field, it is difficult to refresh the
screen yourself. It's not impossible, but it is ugly:
clear
*-- State variable
public n_MemoScrn
* 0 == no checking
* 1 == initial entry into memo field
* 2 == grab next key
* 3 == screen saved
*-- Set state for initial entry into memo field
n_MemoScrn = 1
@ 4, 6 get C1 && Dummy char field
@ 6, 6 get MEMO_FIELD ;
when ForcValid() ;
valid required MemoScrn() ;
error "" ;
message " Memo kludge "
@ 8, 6 get C2 && Dummy char field
@ 22, 0 to 23,79 double
read
release n_MemoScrn
RETURN
FUNCTION ForcValid
if n_MemoScrn = 1
*-- Move to next stage
n_MemoScrn = 2
*-- Trigger VALID check
keyboard "{CTRL-M}"
*-- Silence bell
set bell to 19,1
endif
if n_MemoScrn = 0
*-- Set state var for next memo field
n_MemoScrn = 1
*-- Restore bell to default tone
set bell to 512,2
endif
RETURN .t.
FUNCTION MemoScrn
private lRet, nKey
if n_MemoScrn > 1
if n_MemoScrn = 3
*-- Restore lines 23 and 24
restore screen from sMemoScrn
release screen sMemoScrn
endif
*-- Wait for keypress
nKey = inkey( 0 )
*-- Return VALID false to force next action to occur in
*-- current field
lRet = .f.
*-- Clear VALID error message
keyboard " "
*-- Ctrl-Home; edit memo
if nKey = 29
save screen to sMemoScrn
n_MemoScrn = 3
*-- Open memo and force recheck
keyboard "{CTRL-HOME}{CTRL-M}"
else
*-- Don't stop the next key
n_MemoScrn = 0
*-- Type the key that was trapped
keyboard "{" + ltrim( str( nKey )) + "}"
endif
else
*-- Pass key through
lRet = .t.
*-- Must init PRIVATE memvar
nKey = 0
endif
RETURN lRet
Suggestions for other workarounds are welcome.
Aborting READ after adding new memo block corrupts memo
-------------------------------------------------------
If while READing a memo field
(1) enough text is added to a memo field such that another
memo block in the .DBT is required
(2) that memo is saved (with Ctrl-End in the editor), and
(3) changes to the record are discarded (with Esc back in
dBASE)
the memo may become corrupted. This is because since the memo
grew, it is saved in a new chain of memo blocks, and the old
blocks are marked as free; but since the changes to the record
are discarded, the pointers in the .DBF are not updated, so they
point to the now free space, confusing everything.
This may be the cause of previously mysterious memo corruption,
since a specific sequence of events and conditions are required.
This problem does not manifest itself with EDIT.
This problem has been traced to a conflict with the mouse. The
current workaround is to disable the mouse in the WHEN clause of
the GET, and to re-enable it in the VALID REQUIRED clause. Or you
can disable the mouse entirely. Since YAME does not support the
mouse, this isn't that bad. The GET for a memo field would look
like this:
@ 6, 6 get MEMO_FIELD ;
when MouseOff() ;
valid required MouseOn()
...
FUNCTION MouseOff
set mouse off
RETURN .t.
FUNCTION MouseOn
set mouse on
RETURN .t.
Memo window wraps at column 65 or soft return, whichever is first
-----------------------------------------------------------------
dBASE will always display a memo in a window wrapped at column
65, or at a soft return code, whichever comes first. By using the
/SS option of YAME, soft return codes are inserted into the text
so that dBASE will display the memo properly. However, if the
margin is wider than 65, this won't work; dBASE will wrap at
column 65 first, and then again at the inserted soft return later
in the line.
If you plan to use memo windows, don't make the margins wider
than 65 characters. An alternative is to use the DispMemo
procedure, which works for all widths.
═════════════════════════════════════════════════════════════════
SUPPORT
═════════════════════════════════════════════════════════════════
Support is provided in the dBASE forum on CompuServe. You can GO
DBASE and post your questions in the dBASE IV Programming or
Addons section. Please do not ask technical questions through
personal mail.
Lately, I've also been hanging out on the MetroLink Database
conference.
If you have any questions, suggestions, anomaly reports, etc.,
contact:
Kenneth Chan CompuServe: 72662,1305
PO Box 50245 Internet: 72662.1305@compuserve.com
Pasadena CA 91115-0245
YAME is available as YAME.ZIP in two primary locations: the DBASE
forum on CompuServe, and at ftp.borland.com.
YAME is made available to the dBASE community free of charge, in
the spirit that made BORBBS great. However, YAME is not in the
public domain; all rights are reserved by the author.
On the other hand, YAME is provided as-is, with no warranty of
any kind. The user (that's you) takes full responsibility. The
author cannot and does not warrant, guarantee, or make any
representations regarding the appropriateness, use of, or results
of the use of YAME; the author will not be liable for any
damages, including but not limited to data loss, system damage,
hair loss, back pain, tension headache, blurred vision, and/or
the inability to simultaneously pat your head and rub your tummy.
*-- EoF: YAME.DOC